package models

import "tuowei.com/common/models"

type QuestionBankWare []struct {
	Name     string `json:"name"`
	Sort     int    `json:"sort"`
	Children []struct {
		Name string `json:"name"`
		URL  string `json:"url"`
		Sort int    `json:"sort"`
	} `json:"children"`
}

type SysExercisesWare struct {
	models.Model
	QuestionBankId    int    `json:"question_bank_id" gorm:"size:5;comment:关联ID"`
	Name              string `json:"name" gorm:"comment:name"`
	QuestionBankWare  string `json:"question_bank_ware" gorm:"comment:题库章节"`
	Pid               int    `json:"pid" gorm:"comment:父级ID"`
	Level             int    `json:"level" gorm:"comment:等级"`
	Sort              int    `json:"sort" gorm:"comment:排序"`
	IsShow            int    `json:"is_show" gorm:"comment:是否展示"`
	IsContainExercise int    `json:"is_contain_exercise" gorm:"comment:题库是否存在习题"`
	IsFree            int    `json:"is_free" comment:"是否付费公开范围"`
	models.ControlBy
	models.ModelTime
}

func (s SysExercisesWare) TableName() string {
	return "sys_exercises_ware"
}

func (s *SysExercisesWare) Generate() models.ActiveRecord {
	o := *s
	return &o
}

func (s *SysExercisesWare) GetId() interface{} {
	return s.Id
}

type ExercisesWareTree struct {
	Id                int                 `gorm:"-" json:"id"`
	QuestionBankId    int                 `json:"question_bank_id" gorm:"-"`
	Sort              int                 `json:"sort" gorm:"-"`
	IsShow            int                 `json:"is_show"`
	IsContainExercise int                 `json:"is_contain_exercise" gorm:"-"`
	IsFree            int                 `json:"is_free" gorm:"-"`
	Name              string              `gorm:"-" json:"name"`
	Url               string              `json:"url" gorm:"-"`
	Pid               int                 `json:"pid" gorm:"-"`
	Children          []ExercisesWareTree `gorm:"-" json:"children"`
}

type ExercisesWareDelete struct {
	Id int `json:"id"`
}

func (s ExercisesWareDelete) TableName() string {
	return "sys_exercises_ware"
}
